<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="box1">
      <ul>
        <li id="red"></li>
        <li id="green"></li>
        <li id="black"></li>
      </ul>
      <table>
        <tr>
          <th>新闻</th>
          <th>娱乐</th>
          <th>体育</th>
          <th>电影</th>
          <th>音乐</th>
          <th>旅游</th>
        </tr>
      </table>
    </div>
  </body>
  <script>
    let body = document.querySelector("body");
    let red = document.getElementById("red");
    let green = document.getElementById("green");
    let black = document.getElementById("black");
    red.onclick = function () {
      body.style.background = "red";
    };
     green.onclick = function () {
      body.style.background = "green";
    };
     black.onclick = function () {
      body.style.background = "black";
    };
  </script>
  <style>
    body {
      margin: 0;
      padding: 0;
    }
    #box1 {
      width: 600px;
      height: 200px;
    }
    ul {
      display: flex;
    }
    li {
      width: 20px;
      height: 20px;
      margin-left: 10px;
      list-style: none;
    }
    #red {
      background-color: red;
    }
    #green {
      background-color: green;
    }
    #black {
      background-color: black;
    }
    tr {
      width: 500px;
      height: 30px;
    }
    th {
      width: 50px;
      height: 30px;
      border: 1px solid green;
    }
  </style>
</html>
